﻿using FlickrXplorer.Web.Objects;
using Microsoft.VisualStudio.DebuggerVisualizers;

namespace FlickrXplorer.Web
{
  /// <summary>
  /// A Visualizer for PhotoData.  
  /// </summary>
  public class PhotoDataVisualizer : DialogDebuggerVisualizer
  {
    protected override void Show(IDialogVisualizerService windowService, 
      IVisualizerObjectProvider objectProvider)
    {
      // TODO: Get the object to display a visualizer for.
      //       Cast the result of objectProvider.GetObject() 
      //       to the type of the object being visualized.
      PhotoData data = (PhotoData)objectProvider.GetObject();

      // TODO: Display your view of the object.
      //       Replace displayForm with your own custom Form or Control.
      using (PhotoDataForm displayForm = new PhotoDataForm(data))
      {
        windowService.ShowDialog(displayForm);
      }
    }

    // TODO: Add the following to your testing code to test the visualizer:
    // 
    //    PhotoDataVisualizer.TestShowVisualizer(new SomeType());
    // 
    /// <summary>
    /// Tests the visualizer by hosting it outside of the debugger.
    /// </summary>
    /// <param name="objectToVisualize">The object to display in the visualizer.</param>
    public static void TestShowVisualizer(object objectToVisualize)
    {
      VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(PhotoDataVisualizer));
      visualizerHost.ShowVisualizer();
    }
  }
}
